package com.touchstone.cloudpacs.controller.tohtml;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;


/**
 * @Description : 页面跳转（路由）控制层,所有页面跳转都在此控制层写
 * @Author : hunter
 * @Date: 2019-07-11 9:02
 * @Version: 1.0
 **/
@ApiIgnore
@Controller
public class HtmlController {

    /**
     * 公共页
     */
    private static final String COMMON = "/common";


    @RequestMapping("/common/404")

    public ModelAndView notFoundPage(ModelAndView mv){
        mv.setViewName(COMMON + "/404");
        return mv;
    }

    @RequestMapping("/common/500")
    public ModelAndView errorPage(ModelAndView mv){
        mv.setViewName(COMMON + "/500");
        return mv;
    }

    @RequestMapping("/common/empty")
    public ModelAndView emptyPage(ModelAndView mv){
        mv.setViewName(COMMON + "/empty_page");
        return mv;
    }

    /**
     * 后台根目录
     */
    private static final String BACKSTAGE = "/backstage";

    @RequestMapping({"/", "/login", "index"})
    public String login() {
        return "/login";
    }

    @RequestMapping("/login/success")
    public ModelAndView loginSuccess(ModelAndView mv){
        mv.setViewName(BACKSTAGE + "/index");
        return mv;
    }

    @RequestMapping("/backstage/indexInfo")
    public ModelAndView indexInfo(ModelAndView mv){
        mv.setViewName(BACKSTAGE + "/index_v1");
        return mv;
    }

    @RequestMapping("/backstage/user/list")
    public String userList(){
        return BACKSTAGE + "/user/list";
    }

    @RequestMapping("/backstage/user/addUser")
    public String addUser(){
        return BACKSTAGE + "/user/addUser";
    }

    @RequestMapping("/backstage/manage/log")
    public String logList(){
        return BACKSTAGE + "/manage/log";
    }

}
